import useCommonStore from "@/store/modules/common";
const commonStore = useCommonStore();
const declarationElementOptions = computed(() => {
  if (!commonStore.declarationElementOptions) {
    commonStore.getDeclarationElementList();
  }
  return commonStore.declarationElementOptions || [];
});

// 批量维护格式
export const matchingMaintenanceFormat = (val) => {
  return new Promise(async(resolve, reject) => {
    if (!val) return null;
    if (!commonStore.declarationElementOptions || commonStore.declarationElementOptions.length === 0) {
      await commonStore.getDeclarationElementList();
    }

    const find = declarationElementOptions.value.find(item => item.project_name === val);
    if (find) {
      resolve(find.project_value)
    } else {
      resolve(null)
    }
  })
};